public class DCGSink extends Sink {
public DCGSink(Sink next) { this.next = next; }
public Stack<Choicepoint> fishFor(String name, int arity, Compound term, int choice, Prolog prolog, Unifier unifier, int cutIndex, Stack<Conjunct> continuation, Stack<Choicepoint> choicepoints) {
Choicepoint choicepoint;
int height = choicepoints.height;
if(arity == 2 && name.equals("$my$term_expansion")) {
switch(choice) {
case 0: {
Variable t2 = new Variable("V0");
Variable t3 = new Variable("V1");
Compound t1 = new Compound("-->", t2, t3);
Variable t5 = new Variable("V2");
Variable t6 = new Variable("V3");
Compound t4 = new Compound(":-", t5, t6);
Compound t0 = new Compound("$my$term_expansion", t1, t4);
Variable t9 = new Variable("V4");
Variable t10 = new Variable("V5");
Compound t8 = new Compound(".", t9, t10);
Compound t7 = new Compound("=..", t2, t8);
Variable t13 = new Variable("V6");
Variable t15 = new Variable("V7");
Compound t16 = new Compound("[]");
Compound t14 = new Compound(".", t15, t16);
Compound t12 = new Compound(".", t13, t14);
Variable t17 = new Variable("V8");
Compound t11 = new Compound("append", t10, t12, t17);
Compound t19 = new Compound(".", t9, t17);
Compound t18 = new Compound("=..", t5, t19);
Compound t21 = new Compound("-->", t13, t15);
Compound t20 = new Compound("thread", t21, t3, t6);
if(unifier.unify(t0,term)) {
choicepoints.head.query = choicepoints.head.query.tail;
choicepoints.head.addQuerents(height-1, t7, t11, t18, t20);
choicepoints.head.addBindings(unifier.bound);
return choicepoints;
}
break;
}
default: choicepoints.head.dead = true;
}
return choicepoints;
}
if(arity == 3 && name.equals("thread")) {
switch(choice) {
case 0: {
Variable t2 = new Variable("V0");
Variable t3 = new Variable("V1");
Compound t1 = new Compound("-->", t2, t3);
Variable t4 = new Variable("V2");
Compound t5 = new Compound("append", t4, t3, t2);
Compound t0 = new Compound("thread", t1, t4, t5);
Compound t6 = new Compound("var", t4);
if(unifier.unify(t0,term)) {
choicepoint = new Choicepoint(continuation,height, t6);
choicepoint.bindings = unifier.bound;
return new Stack<Choicepoint>(choicepoint,choicepoints);
}
break;
}
case 1: {
Variable t2 = new Variable("V0");
Variable t3 = new Variable("V1");
Compound t1 = new Compound("-->", t2, t3);
Variable t5 = new Variable("V2");
Variable t6 = new Variable("V3");
Compound t4 = new Compound(",", t5, t6);
Variable t8 = new Variable("V4");
Variable t9 = new Variable("V5");
Compound t7 = new Compound(",", t8, t9);
Compound t0 = new Compound("thread", t1, t4, t7);
Variable t12 = new Variable("V6");
Compound t11 = new Compound("-->", t2, t12);
Compound t10 = new Compound("thread", t11, t5, t8);
Compound t14 = new Compound("-->", t12, t3);
Compound t13 = new Compound("thread", t14, t6, t9);
if(unifier.unify(t0,term)) {
choicepoint = new Choicepoint(continuation,height, t10, t13);
choicepoint.bindings = unifier.bound;
return new Stack<Choicepoint>(choicepoint,choicepoints);
}
break;
}
case 2: {
Variable t2 = new Variable("V0");
Variable t3 = new Variable("V1");
Compound t1 = new Compound("-->", t2, t3);
Variable t6 = new Variable("V2");
Variable t7 = new Variable("V3");
Compound t5 = new Compound("->", t6, t7);
Variable t8 = new Variable("V4");
Compound t4 = new Compound(";", t5, t8);
Variable t11 = new Variable("V5");
Variable t12 = new Variable("V6");
Compound t10 = new Compound("->", t11, t12);
Variable t13 = new Variable("V7");
Compound t9 = new Compound(";", t10, t13);
Compound t0 = new Compound("thread", t1, t4, t9);
Variable t16 = new Variable("V8");
Compound t15 = new Compound("-->", t2, t16);
Compound t14 = new Compound("thread", t15, t6, t11);
Compound t18 = new Compound("-->", t16, t3);
Compound t17 = new Compound("thread", t18, t7, t12);
Compound t20 = new Compound("-->", t2, t3);
Compound t19 = new Compound("thread", t20, t8, t13);
if(unifier.unify(t0,term)) {
choicepoint = new Choicepoint(continuation,height, t14, t17, t19);
choicepoint.bindings = unifier.bound;
return new Stack<Choicepoint>(choicepoint,choicepoints);
}
break;
}
case 3: {
Variable t2 = new Variable("V0");
Variable t3 = new Variable("V1");
Compound t1 = new Compound("-->", t2, t3);
Variable t5 = new Variable("V2");
Variable t6 = new Variable("V3");
Compound t4 = new Compound("->", t5, t6);
Variable t8 = new Variable("V4");
Variable t9 = new Variable("V5");
Compound t7 = new Compound("->", t8, t9);
Compound t0 = new Compound("thread", t1, t4, t7);
Variable t12 = new Variable("V6");
Compound t11 = new Compound("-->", t2, t12);
Compound t10 = new Compound("thread", t11, t5, t8);
Compound t14 = new Compound("-->", t12, t3);
Compound t13 = new Compound("thread", t14, t6, t9);
if(unifier.unify(t0,term)) {
choicepoint = new Choicepoint(continuation,height, t10, t13);
choicepoint.bindings = unifier.bound;
return new Stack<Choicepoint>(choicepoint,choicepoints);
}
break;
}
case 4: {
Variable t2 = new Variable("V0");
Variable t3 = new Variable("V1");
Compound t1 = new Compound("-->", t2, t3);
Variable t5 = new Variable("V2");
Variable t6 = new Variable("V3");
Compound t4 = new Compound(";", t5, t6);
Variable t8 = new Variable("V4");
Variable t9 = new Variable("V5");
Compound t7 = new Compound(";", t8, t9);
Compound t0 = new Compound("thread", t1, t4, t7);
Compound t11 = new Compound("-->", t2, t3);
Compound t10 = new Compound("thread", t11, t5, t8);
Compound t13 = new Compound("-->", t2, t3);
Compound t12 = new Compound("thread", t13, t6, t9);
if(unifier.unify(t0,term)) {
choicepoint = new Choicepoint(continuation,height, t10, t12);
choicepoint.bindings = unifier.bound;
return new Stack<Choicepoint>(choicepoint,choicepoints);
}
break;
}
case 5: {
Variable t2 = new Variable("V0");
Variable t3 = new Variable("V1");
Compound t1 = new Compound("-->", t2, t3);
Compound t4 = new Compound("[]");
Compound t5 = new Compound("=", t2, t3);
Compound t0 = new Compound("thread", t1, t4, t5);
if(unifier.unify(t0,term)) {
choicepoint = new Choicepoint(continuation,height);
choicepoint.bindings = unifier.bound;
return new Stack<Choicepoint>(choicepoint,choicepoints);
}
break;
}
case 6: {
Variable t2 = new Variable("V0");
Variable t3 = new Variable("V1");
Compound t1 = new Compound("-->", t2, t3);
Variable t5 = new Variable("V2");
Variable t6 = new Variable("V3");
Compound t4 = new Compound(".", t5, t6);
Variable t8 = new Variable("V4");
Compound t7 = new Compound("=", t2, t8);
Compound t0 = new Compound("thread", t1, t4, t7);
Compound t10 = new Compound(".", t5, t6);
Compound t9 = new Compound("append", t10, t3, t8);
if(unifier.unify(t0,term)) {
choicepoint = new Choicepoint(continuation,height, t9);
choicepoint.bindings = unifier.bound;
return new Stack<Choicepoint>(choicepoint,choicepoints);
}
break;
}
case 7: {
Variable t2 = new Variable("V0");
Variable t3 = new Variable("V1");
Compound t1 = new Compound("-->", t2, t3);
Variable t5 = new Variable("V2");
Compound t4 = new Compound("{}", t5);
Compound t7 = new Compound("=", t2, t3);
Compound t6 = new Compound(",", t7, t5);
Compound t0 = new Compound("thread", t1, t4, t6);
if(unifier.unify(t0,term)) {
choicepoint = new Choicepoint(continuation,height);
choicepoint.bindings = unifier.bound;
return new Stack<Choicepoint>(choicepoint,choicepoints);
}
break;
}
case 8: {
Variable t2 = new Variable("V0");
Variable t3 = new Variable("V1");
Compound t1 = new Compound("-->", t2, t3);
Compound t4 = new Compound("!");
Compound t6 = new Compound("=", t2, t3);
Compound t7 = new Compound("!");
Compound t5 = new Compound(",", t6, t7);
Compound t0 = new Compound("thread", t1, t4, t5);
if(unifier.unify(t0,term)) {
choicepoint = new Choicepoint(continuation,height);
choicepoint.bindings = unifier.bound;
return new Stack<Choicepoint>(choicepoint,choicepoints);
}
break;
}
case 9: {
Variable t2 = new Variable("V0");
Variable t3 = new Variable("V1");
Compound t1 = new Compound("-->", t2, t3);
Variable t4 = new Variable("V2");
Variable t5 = new Variable("V3");
Compound t0 = new Compound("thread", t1, t4, t5);
Variable t8 = new Variable("V4");
Variable t9 = new Variable("V5");
Compound t7 = new Compound(".", t8, t9);
Compound t6 = new Compound("=..", t4, t7);
Compound t13 = new Compound("[]");
Compound t12 = new Compound(".", t3, t13);
Compound t11 = new Compound(".", t2, t12);
Variable t14 = new Variable("V6");
Compound t10 = new Compound("append", t9, t11, t14);
Compound t16 = new Compound(".", t8, t14);
Compound t15 = new Compound("=..", t5, t16);
if(unifier.unify(t0,term)) {
choicepoints.head.query = choicepoints.head.query.tail;
choicepoints.head.addQuerents(height-1, t6, t10, t15);
choicepoints.head.addBindings(unifier.bound);
return choicepoints;
}
break;
}
default: choicepoints.head.dead = true;
}
return choicepoints;
}
return next.fishFor(name,arity,term,choice,prolog,unifier,cutIndex,continuation,choicepoints);
}
}
